<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    

    <title>Jenkins持续构建（初级版本） | 竹隐江南的博客</title>
    <meta name="author" content="dzy20@qq.com">
    
    <meta name="description" content="Jenkins持续构建（初级版），为何是初级版，就是只用了插件和脚本，而没有用pipline和官方推荐的handbook进行构建，因为手中事情比较多，最熟悉这个方式，所以先优先做这个方式，后续会持续更新改进该系列。">
    
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <meta property="og:title" content="Jenkins持续构建（初级版本）"/>
    <meta property="og:site_name" content="必须有人浴血奋战，世上才有自由可言！"/>

    
    <meta property="og:image" content="undefined"/>
    

    <link rel="icon" type="image/png" href="/favicon.png">
    <link rel="alternate" href="/atom.xml" title="必须有人浴血奋战，世上才有自由可言！" type="application/atom+xml">
    <link rel="stylesheet" href="/css/lib/materialize.min.css">
    <link rel="stylesheet" href="/css/lib/font-awesome.min.css">
    <link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">

    
        <link rel="stylesheet" href="/css/lib/prettify-tomorrow-night-eighties.css" type="text/css">
    
    <!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>


<body>
    <img src="/weixin_favicon.png" style="position: absolute; left: -9999px; opacity: 0; filter: alpha(opacity=0);">

    <nav class="green">
    <div class="nav-wrapper">
        <a href="#" data-activates="main-menu" class="button-collapse">
            <i class="fa fa-navicon"></i>
        </a>
        <div class="">
            <a href="/" class="brand-logo hide-on-med-and-down">必须有人浴血奋战，世上才有自由可言！</a>
            <ul class="right hide-on-med-and-down">
                
                    <li>
                        <a class="menu-home " href="/" >
                            <i class="fa fa-home "></i>
                            
                            首页
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-archive " href="/archives" >
                            <i class="fa fa-archive "></i>
                            
                            归档
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                            <i class="fa fa-bookmark "></i>
                            
                            分类
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-reading " href="/reading" >
                            <i class="fa fa-book "></i>
                            
                            读书
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-about " href="/about" >
                            <i class="fa fa-user "></i>
                            
                            关于
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-search modal-trigger " href="#search" >
                            <i class="fa fa-search "></i>
                            
                            搜索
                        </a>
                    </li>
                
            </ul>
            <div>
    <ul class="side-nav green darken-1" id="main-menu">
        
        <li class="side-user">
            <div class="row">
                <div class="col s4 no-padding">
                    <img class="avatar-image circle responsive-img" src="https://static.oschina.net/uploads/user/728/1456911_100.jpg?t=1393495702000" alt="User Avatar">
                </div>
                <div class="info col s8 valign-wrapper no-padding">
                    <div class="valign">
                        <p class="name">竹隐江南</p>
                        <p class="desc">Java后端/技术宅</p>
                    </div>
                </div>
            </div>
        </li>
        

        
            <li class="no-padding">
                <a class="waves-effect menu-home " href="/" >
                    <i class="fa fa-home "></i>
                    
                    首页
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-archive " href="/archives" >
                    <i class="fa fa-archive "></i>
                    
                    归档
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                    <i class="fa fa-bookmark "></i>
                    
                    分类
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-reading " href="/reading" >
                    <i class="fa fa-book "></i>
                    
                    读书
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-about " href="/about" >
                    <i class="fa fa-user "></i>
                    
                    关于
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-search modal-trigger " href="#search" >
                    <i class="fa fa-search "></i>
                    
                    搜索
                </a>
            </li>
        
    </ul>

    <ul class="side-nav green darken-1" id="category-menu">
    

            

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/hive/">
                    hive <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/Docker/">
                    Docker <span class="right">10 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/操作系统/">
                    操作系统 <span class="right">7 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/系统架构/">
                    系统架构 <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/DevOps-CI/">
                    DevOps-CI <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/SSL/">
                    SSL <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/springboot/">
                    springboot <span class="right">8 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/Linux/">
                    Linux <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-1" collapse-level="1">
                <a class="no-padding" href="/categories/Linux/Tomcat/">
                    Tomcat <span class="right">1 篇</span></a>
                </a>
            </li>

        

    </ul>
</div>

        </div>
    </div>
</nav>

<div id="search" class="modal search-modal">
    <div class="row">
        <div class="input-field col s12">
              <input id="search-input" type="text">
              <label for="search-input">搜索</label>
        </div>

    </div>
    <div id="search-result" class="search-result col s12">

    </div>
</div>


    <main>
        <div class="container main-container">
    <nav class="page-nav hide-on-small-only">
    <div class="nav-wrapper green">
        <span class="breadcrumb">当前位置（分类目录）</span>
        
            
    
    
    <a class="breadcrumb" href="/categories/DevOps-CI/">DevOps/CI</a>


        

        
    </div>
</nav>

<article>
    <div class="card">
        <div class="card-content">
            

            <div class="article-title">
                
    
        <h1>Jenkins持续构建（初级版本）</h1>
    


            </div>
            <time class="red-link-context" datetime="2017-10-26T12:44:00.000Z"><a href="/2017/10/26/Jenkins持续构建（初级版本）/">2017-10-26</a></time>

            <span id="busuanzi_container_page_pv" class="read-times-container">
    <i class="fa fa-eye"></i>
    <span id="busuanzi_value_page_pv"></span>
</span>

            
    <div class="tags-row">
        
            <a href="/tags/Jenkines/" class="chip red lighten-1">Jenkines</a>
        
            <a href="/tags/DevOps-CI/" class="chip red lighten-1">DevOps/CI</a>
        
    </div>


            <div class="toc red-link-context hide-on-med-and-down">
    <ol class="section table-of-contents"><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#环境安装"><span class="section table-of-contents-text">环境安装</span></a></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#jenkins安装"><span class="section table-of-contents-text">jenkins安装</span></a></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#Jenkins配置及其他插件安装"><span class="section table-of-contents-text">Jenkins配置及其他插件安装</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#环境配置"><span class="section table-of-contents-text">环境配置</span></a></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#其他插件安装"><span class="section table-of-contents-text">其他插件安装</span></a></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#配置插件Publish-Over-SSH"><span class="section table-of-contents-text">配置插件Publish Over SSH</span></a></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#进入主题，自动部署"><span class="section table-of-contents-text">进入主题，自动部署</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#新建一个任务，ant脚本方式"><span class="section table-of-contents-text">新建一个任务，ant脚本方式</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#新建任务"><span class="section table-of-contents-text">新建任务</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#基本配置"><span class="section table-of-contents-text">基本配置</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#配置svn代码库"><span class="section table-of-contents-text">配置svn代码库</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建触发器"><span class="section table-of-contents-text">构建触发器</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建"><span class="section table-of-contents-text">构建</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建后的操作"><span class="section table-of-contents-text">构建后的操作</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#保存后执行构建"><span class="section table-of-contents-text">保存后执行构建</span></a></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#新建一个ITEM，Maven方式"><span class="section table-of-contents-text">新建一个ITEM，Maven方式</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#新建任务-1"><span class="section table-of-contents-text">新建任务</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#基本配置，代码库，构建触发器"><span class="section table-of-contents-text">基本配置，代码库，构建触发器</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建-1"><span class="section table-of-contents-text">构建</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建后的操作-1"><span class="section table-of-contents-text">构建后的操作</span></a></li></ol></li><li class="section table-of-contents-item section table-of-contents-level-2"><a class="section table-of-contents-link" href="#多个任务顺序执行"><span class="section table-of-contents-text">多个任务顺序执行</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#新建任务-2"><span class="section table-of-contents-text">新建任务</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#构建-2"><span class="section table-of-contents-text">构建</span></a></li></ol></li></ol></li></ol>
</div>


            <div class="entry red-link-context">
                <blockquote>
<p>Jenkins持续构建（初级版），为何是初级版，就是只用了插件和脚本，而没有用pipline和官方推荐的handbook进行构建，因为手中事情比较多，最熟悉这个方式，所以先优先做这个方式，后续会持续更新改进该系列。笔者大概13年的时候用过不是很人性化，现在没想到这么强大了！感谢官方的线下活动，感谢IBM童鞋赞助的门票去了解了才发现已经如此强大。<br>项目情况比较特殊两个项目一个是非maven一个是maven的需要同时持续集成一个服务，期间还特地去看了一下ant，构建了ant脚本在此感概下ant真是强大，只是还是稍微复杂了一些。（弄完后，有人告诉我idea可以自动生成ant脚本，我还试了一下果然是可以的！！！！！）</p>
</blockquote>
<a id="more"></a> 
<h1 id="环境安装"><a href="#环境安装" class="headerlink" title="环境安装"></a>环境安装</h1><blockquote>
<p>环境问题，大家先可以忽略掉ant，只看maven部分。</p>
</blockquote>
<ol>
<li>安装jdk，我直接装的jdk8，环境变量配置这个不用说了吧</li>
<li>安装ant，<code>wget http://mirrors.tuna.tsinghua.edu.cn/apache//ant/binaries/apache-ant-1.10.1-bin.tar.gz</code>，挤压，设置环境变量</li>
<li>安装maven，<code>wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz</code>安装环境变量</li>
<li>编辑/etc/profile 设置如下<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">export JAVA_HOME=/usr/local/src/jdk1.8.0_121</div><div class="line">export PATH=$JAVA_HOME/bin:$PATH </div><div class="line">export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar</div><div class="line">export ANT_HOME=/usr/local/apache-ant-1.10.1</div><div class="line">export PATH=$PATH:$ANT_HOME/bin</div><div class="line">export MAVEN_HOME=/usr/local/apache-maven-3.5.0</div><div class="line">export PATH=$&#123;PATH&#125;:$&#123;MAVEN_HOME&#125;/bin</div></pre></td></tr></table></figure>
</li>
</ol>
<p>source 一下生效配置</p>
<ol>
<li>安装tomcat</li>
<li>下载jenkins版本，我咨询过资深（布道者）推荐是2.73.2或者最新的 2.86一般官网也会有放。推荐安装方式是war包方式，<code>weget http://mirrors.jenkins.io/war/latest/jenkins.war</code></li>
</ol>
<h1 id="jenkins安装"><a href="#jenkins安装" class="headerlink" title="jenkins安装"></a>jenkins安装</h1><ol>
<li><p>安装方式特别简单，就是把jenkins.war放入tomcat中，启动！<br>注意看后台，会初始化jenkins的初始化密码及初始化密码路径，如果没看也没事情，访问首页的时候也会提示路径</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">*************************************************************</div><div class="line">*************************************************************</div><div class="line">*************************************************************</div><div class="line"></div><div class="line">Jenkins initial setup is required. An admin user has been created and a password generated.</div><div class="line">Please use the following password to proceed to installation:</div><div class="line"></div><div class="line">3b411b9ac8374148a54a61101e897e3f</div><div class="line"></div><div class="line">This may also be found at: /root/.jenkins/secrets/initialAdminPassword</div><div class="line"></div><div class="line">*************************************************************</div><div class="line">*************************************************************</div><div class="line">*************************************************************</div></pre></td></tr></table></figure>
</li>
<li><p>通过浏览器访问<a href="http://ip:端口/jenkins" target="_blank" rel="external">http://ip:端口/jenkins</a><br><img src="https://static.oschina.net/uploads/img/201710/26214633_iism.png" alt="初始化密码" title="初始化密码"></p>
</li>
<li><p>选择安装推荐插件模式，第二个是自己选择，此处选择推荐的即第一个<br><img src="https://static.oschina.net/uploads/img/201710/26215013_rqvu.png" alt="推荐安装插件" title="选择安装推荐插件"></p>
</li>
<li><p>等待自行安装插件，后续笔者会写还会用到的哪些插件<br><img src="https://static.oschina.net/uploads/img/201710/26215217_tfsz.png" alt="等待自行安装插件" title="等待自行安装插件"></p>
</li>
<li><p>插件安装完毕，创建第一个用户<br><img src="https://static.oschina.net/uploads/img/201710/26220728_DHvR.png" alt="初始化一个用户" title="初始化一个用户"></p>
</li>
<li>创建完毕后，就可以使用Jenkins了<br><img src="https://static.oschina.net/uploads/img/201710/26220921_yO7A.png" alt="输入图片说明" title="在这里输入图片标题"></li>
</ol>
<h1 id="Jenkins配置及其他插件安装"><a href="#Jenkins配置及其他插件安装" class="headerlink" title="Jenkins配置及其他插件安装"></a>Jenkins配置及其他插件安装</h1><h2 id="环境配置"><a href="#环境配置" class="headerlink" title="环境配置"></a>环境配置</h2><p>全局环境变量配置，进入后配置其中的邮件发送，jenkins相关信息<br><img src="https://static.oschina.net/uploads/img/201710/26221125_kosQ.png" alt="系统设置" title="系统设置"><br><img src="https://static.oschina.net/uploads/img/201710/26222854_G1RN.png" alt="输入图片说明" title="配置JENKINS"><br>配置JDK，MAVEN,GIT,ANT等，此处是指安装在服务器上的工具目录等<br><img src="https://static.oschina.net/uploads/img/201710/26223052_LVn8.png" alt="输入图片说明" title="配置maven等位置"><br><img src="https://static.oschina.net/uploads/img/201710/26223901_bl33.png" alt="输入图片说明" title="配置ant与maven的位置"></p>
<h2 id="其他插件安装"><a href="#其他插件安装" class="headerlink" title="其他插件安装"></a>其他插件安装</h2><p>常用插件Jenkins都给安装了，比如，ant，maven，gradle，ssh,email，git。由于项目历史原因我这项目还需要一些其他的插件，比如</p>
<pre><code>* Deploy to container Plugin (部署到Java容器中的插件)这个插件我没有用，因为项目有个非常传统的项目，客户上传的图片在tomcat中，没有做资源分离，所以每次还得部署还原。如果你的项目分离，可以使用这个插件，需要修改tomcat的user.xml权限，自行百度使用吧。
* Publish Over SSH (远程Shell)
* Multijob plugin (多个任务顺序执行)
</code></pre><p>  安装插件上述的两个插件<br>  <img src="https://static.oschina.net/uploads/img/201710/26223901_bl33.png" alt="输入图片说明" title="进入安装插件页面"><br>  <img src="https://static.oschina.net/uploads/img/201710/26225904_Afyb.png" alt="输入图片说明" title="安装插件"><br>  <img src="https://static.oschina.net/uploads/img/201710/26230732_i7on.png" alt="输入图片说明" title="等待安装完成"><br>  安装完成后，建议重启一边Jenkins。在页面就可以啦，重启完会自动刷新的</p>
<blockquote>
<p>Please wait while Jenkins is restarting.<br>当Jenkins就绪的时候，你的浏览器会自动刷新</p>
</blockquote>
<h2 id="配置插件Publish-Over-SSH"><a href="#配置插件Publish-Over-SSH" class="headerlink" title="配置插件Publish Over SSH"></a>配置插件Publish Over SSH</h2><p>这个插件是远程Shell的，而我们项目是需要同时部署10多台服务器的，所以需要把10多台服务器配置上去<br>路径： <code>系统管理--&gt;系统设置</code><br><img src="https://static.oschina.net/uploads/img/201710/26232119_zssD.png" alt="输入图片说明" title="点击新增"><br><img src="https://static.oschina.net/uploads/img/201710/26232034_jE3x.png" alt="输入图片说明" title="输入相关信息"><br><img src="https://static.oschina.net/uploads/img/201710/26232340_ZnsH.png" alt="输入图片说明" title="选择密码"><br>特殊说明的是Remote Directory这个目录是指某人远程上传或者操作的目录，填写完毕后，可以点击一下“Test Confirgure”测试一下，如果成功会显示Success的</p>
<h1 id="进入主题，自动部署"><a href="#进入主题，自动部署" class="headerlink" title="进入主题，自动部署"></a>进入主题，自动部署</h1><h2 id="新建一个任务，ant脚本方式"><a href="#新建一个任务，ant脚本方式" class="headerlink" title="新建一个任务，ant脚本方式"></a>新建一个任务，ant脚本方式</h2><h3 id="新建任务"><a href="#新建任务" class="headerlink" title="新建任务"></a>新建任务</h3><p>我第一个项目是ant脚本打包的，所以选择新建一个自由风格的任务<br><img src="https://static.oschina.net/uploads/img/201710/29174535_fpj0.png" alt="输入图片说明" title="新建自由风格的项目"></p>
<h3 id="基本配置"><a href="#基本配置" class="headerlink" title="基本配置"></a>基本配置</h3><p>我这只选择了构建保留天数与数量，这个可以根据需求来<br><img src="https://static.oschina.net/uploads/img/201710/29174815_beLA.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="配置svn代码库"><a href="#配置svn代码库" class="headerlink" title="配置svn代码库"></a>配置svn代码库</h3><p><img src="https://static.oschina.net/uploads/img/201710/29175108_7o6Z.png" alt="输入图片说明" title="在这里输入图片标题"><br><img src="https://static.oschina.net/uploads/img/201710/29175325_Mznz.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="构建触发器"><a href="#构建触发器" class="headerlink" title="构建触发器"></a>构建触发器</h3><p>此处我没有设置，因为是生产环境，如果是测试环境可以设置定时执行任务</p>
<h3 id="构建"><a href="#构建" class="headerlink" title="构建"></a>构建</h3><p>构建步骤，选择ant构建<br><img src="https://static.oschina.net/uploads/img/201710/29175737_qYPf.png" alt="输入图片说明" title="在这里输入图片标题"><br>如果你的ant脚本是用build.xml<br><img src="https://static.oschina.net/uploads/img/201710/29175929_fIs2.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="构建后的操作"><a href="#构建后的操作" class="headerlink" title="构建后的操作"></a>构建后的操作</h3><p><img src="https://static.oschina.net/uploads/img/201710/29181654_emMq.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<p><img src="https://static.oschina.net/uploads/img/201710/29181707_CnVx.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="保存后执行构建"><a href="#保存后执行构建" class="headerlink" title="保存后执行构建"></a>保存后执行构建</h3><h2 id="新建一个ITEM，Maven方式"><a href="#新建一个ITEM，Maven方式" class="headerlink" title="新建一个ITEM，Maven方式"></a>新建一个ITEM，Maven方式</h2><h3 id="新建任务-1"><a href="#新建任务-1" class="headerlink" title="新建任务"></a>新建任务</h3><p><img src="https://static.oschina.net/uploads/img/201710/29184417_ioN4.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="基本配置，代码库，构建触发器"><a href="#基本配置，代码库，构建触发器" class="headerlink" title="基本配置，代码库，构建触发器"></a>基本配置，代码库，构建触发器</h3><p>参照ant方式一样的</p>
<h3 id="构建-1"><a href="#构建-1" class="headerlink" title="构建"></a>构建</h3><p><img src="https://static.oschina.net/uploads/img/201710/29184731_Afz6.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="构建后的操作-1"><a href="#构建后的操作-1" class="headerlink" title="构建后的操作"></a>构建后的操作</h3><p>构建后的操作，要注意的是点开 高级，点击4勾选，这个如果不勾选，你在shell脚本中写的循环判断的问题可能会引起异常返回信息<br>步骤3中的脚本是目标服务器目录中的路径<br><img src="https://static.oschina.net/uploads/img/201710/29185011_VlAr.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h2 id="多个任务顺序执行"><a href="#多个任务顺序执行" class="headerlink" title="多个任务顺序执行"></a>多个任务顺序执行</h2><p>多个任务执行需要安装插件，前面插件部分已经安装了。</p>
<h3 id="新建任务-2"><a href="#新建任务-2" class="headerlink" title="新建任务"></a>新建任务</h3><p><img src="https://static.oschina.net/uploads/img/201710/29191045_OYJL.png" alt="输入图片说明" title="在这里输入图片标题"></p>
<h3 id="构建-2"><a href="#构建-2" class="headerlink" title="构建"></a>构建</h3><p>任务是顺序执行的<br><img src="https://static.oschina.net/uploads/img/201710/29191246_YDjE.png" alt="输入图片说明" title="在这里输入图片标题"></p>

                
<p class="red-link-context">
    <a href="/2018/07/04/Win开发常用工具整理/" rel="next" title="Win常用开发工具整理">
    上一篇：Win常用开发工具整理
  </a>
</p>



<p class="red-link-context">
    <a href="/2017/07/28/Tomcat7+ Linux系统中启动慢解决方法/" rel="next" title="Tomcat7+ Linux系统中启动慢解决方法">
    下一篇：Tomcat7+ Linux系统中启动慢解决方法
  </a>
</p>


            </div>
			
        </div>
    </div>
</article>




    <section id="comment">
        <div class="card">
            <div class="card-content">
                <!-- Duoshuo Comment BEGIN -->
                <div class="ds-thread" data-thread-key="2017/10/26/Jenkins持续构建（初级版本）/" data-title="Jenkins持续构建（初级版本）" data-url="http://dengzy007hi.oschina.io/2017/10/26/Jenkins持续构建（初级版本）/"></div>

                <script type="text/javascript">
                    console.log(document.querySelector('.ds-thread'));
                    var duoshuoQuery = {
                        short_name: 'dengzy007hi'
                    };
                    (function() {
                        var ds = document.createElement('script');
                        ds.type = 'text/javascript';
                        ds.async = true;
                        ds.src = (document.location.protocol == 'https:'
                            ? 'https:'
                            : 'http:') + '//static.duoshuo.com/embed.js';
                        ds.charset = 'UTF-8';
                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ds);
                    })();
                </script>
                <!-- Duoshuo Comment END -->
            </div>
        </div>
    </section>



</div>

        <div class="fixed-action-btn float-sitemap">
    <a class="btn-floating btn-large red">
      <i class="fa fa-caret-square-o-up"></i>
    </a>
    <ul>
      <li><a class="btn-return-top btn-floating waves-effect cyan" title="回到顶部"><i class="fa fa-arrow-circle-o-up"></i></a></li>
      <li><a class="btn-floating waves-effect button-collapse light-green"  data-activates="main-menu" title="menu"><i class="fa fa-navicon"></i></a></li>
    </ul>
  </div>

    </main>
    <footer class="page-footer green darken-1">
    
    <div class="container">
        <div class="row">
            
            <div class="social-group col m4 s12">
                <h5 class="white-text">社交</h5>
                
                    <a class="social-link" href="http://weibo.com/bambooJN" target="_blank">
                        <i class="fa fa-2x fa-weibo"></i>
                    </a>
                
                    <a class="social-link" href="https://git.oschina.net/dengzy007hi" target="_blank">
                        <i class="fa fa-2x fa-github"></i>
                    </a>
                
                    <a class="social-link" href="/atom.xml" target="_blank">
                        <i class="fa fa-2x fa-rss"></i>
                    </a>
                
                <div class="site-visitors-container white-text">
                    <span>
                        <i class="fa fa-user"></i>
                        <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
                    </span>
                    <span>&nbsp;|&nbsp;</span>
                    <span>
                        <i class="fa fa-eye"></i>
                        <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
                    </span>
                </div>
            </div>
            

            
            <div class="col m8 s12">
                <h5 class="white-text">友情链接</h5>
                
                    <a class="social-link" href="https://www.oschina.net" target="_blank">开源中国</a>
                
                    <a class="social-link" href="http://jdkleo.iteye.com/" target="_blank">JDKLEO</a>
                
                    <a class="social-link" href="http://pkaq.org/" target="_blank">如是我闻</a>
                
            </div>
            
        </div>
    </div>
    

    <div class="footer-copyright red-link-context">
        <div class="container">
            © 2017 dzy20@qq.com, All rights reserved.
            <p class="right" style="margin-top: 0;">本博客由 <a href="https://hexo.io">Hexo</a> 强力驱动 | 主题 <a href="https://github.com/raytaylorlin/hexo-theme-raytaylorism">raytaylorism</a></p>
        </div>
    </div>
</footer>


    <noscript>
    <div class="noscript">
        <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
    </div>
</noscript>
<div class="noscript">
    <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
</div>


<script src="/js/jquery.min.js"></script>
<script src="/js/materialize.min.js"></script>
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

<script>
    (function($) {
        $(document).ready(function() {
            // 隐藏禁用javascript（针对微信内置浏览器）的提示
            $('.noscript').hide();

            // 图片缩放效果
            var $imgs = $('img').not('.slider-image').not('.avatar-image').not('.carousel-image').not('.card-cover-image').not('.qrcode');

            // 给图片加上点击放大效果（materialbox插件）
            $imgs.addClass('materialboxed').each(function(i, el) {
                $(this).attr('data-caption', $(this).attr('alt') || ' ');
            }).materialbox();

            // 优化表格的显示
            $('table').each(function() {
                var $table = $(this);
                // 除去多行代码的情况
                if ($table.find('pre').length == 0) {
                    $table.addClass('responsive-table striped bordered');
                }
            });

            // 首页幻灯片
            $('.slider').slider({indicators: true, full_width: true, interval: 8000});

            $(".button-collapse").sideNav();
            $(".category-menu").sideNav();

            // 针对gallery post
            $('.carousel').carousel({full_width: true});
            $('.carousel-control.prev').click(function() {
                $('.carousel').carousel('prev');
            });
            $('.carousel-control.next').click(function() {
                $('.carousel').carousel('next');
            });

            // 文章目录
            $('article').not('.simple-article').find('h1').add('h2').add('h3').add('h4').add('h5').add('h6').scrollSpy();

            // 目录随屏幕滚动（防止目录过长越过footer）
            var $toc = $('.toc');
            var scrollTargetTop = 0;
            $(window).scroll(function() {
                var $activeLink = $toc.find('a.active.section');
                if ($(window).scrollTop() < 100) {
                    scrollTargetTop = 0;
                } else {
                    if ($activeLink[0]) {
                        scrollTargetTop = $activeLink.offset().top - $toc.offset().top;
                    }
                }
                $toc.css('top', '-' + scrollTargetTop + 'px');
            });

            // 修正文章目录的left-border颜色
            var color = $('.table-of-contents-text').css('color');
            $('.table-of-contents-link').css('border-left-color', color);

            // 针对移动端做的优化：FAB按钮点击一下收回
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                $('.fixed-action-btn').addClass('click-to-toggle');
            }
            // 回到顶部
            $('.btn-return-top').click(function() {
                $('body, html').animate({
                    scrollTop: 0
                }, 500);
            });

            // 重置读书页面的Tab标签页的颜色
            $('li.tab a').hover(function() {
                $(this).toggleClass('text-lighten-4');
            });
            $('.indicator').addClass('red lighten-2');

            
            // 添加new标签
            $('.menu-about').append('<span class="new badge red"></span>');
            

            // 搜索功能
            $('.modal-trigger').leanModal({
                // 打开搜索框时自动聚焦
                ready: function() {
                    if ($('#search').is(":visible")) {
                        $('#search-input').focus();
                    }
                }
            });
            var searchXml = "search.xml";
            if (searchXml.length == 0) {
             	searchXml = "search.xml";
            }
            var searchPath = "/" + searchXml;
            initSearch(searchPath, 'search-input', 'search-result');
        });

        // 初始化搜索与匹配函数
        var initSearch = function(path, search_id, content_id) {
            'use strict';
            $.ajax({
                url: path,
                dataType: "xml",
                success: function(xmlResponse) {
                    // get the contents from search data
                    var datas = $("entry", xmlResponse).map(function() {
                        return {
                            title: $("title", this).text(),
                            content: $("content", this).text(),
                            url: $("url", this).text()
                        };
                    }).get();
                    var $input = document.getElementById(search_id);
                    var $resultContent = document.getElementById(content_id);
                    $input.addEventListener('input', function() {
                        var str = '<ul class=\"search-result-list\">';
                        var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                        $resultContent.innerHTML = "";
                        if (this.value.trim().length <= 0) {
                            return;
                        }
                        // perform local searching
                        datas.forEach(function(data) {
                            var isMatch = true;
                            var content_index = [];
                            var data_title = data.title.trim().toLowerCase();
                            var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                            var data_url = data.url;
                            var index_title = -1;
                            var index_content = -1;
                            var first_occur = -1;
                            // only match artiles with not empty titles and contents
                            if (data_title != '' && data_content != '') {
                                keywords.forEach(function(keyword, i) {
                                    index_title = data_title.indexOf(keyword);
                                    index_content = data_content.indexOf(keyword);
                                    if (index_title < 0 && index_content < 0) {
                                        isMatch = false;
                                    } else {
                                        if (index_content < 0) {
                                            index_content = 0;
                                        }
                                        if (i == 0) {
                                            first_occur = index_content;
                                        }
                                    }
                                });
                            }
                            // show search results
                            if (isMatch) {
                                keywords.forEach(function(keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    data_title = data_title.replace(regS, "<span class=\"search-keyword red lighten-2\">" + keyword + "</span>");
                                });

                                str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                                var content = data.content.trim().replace(/<[^>]+>/g, "");
                                if (first_occur >= 0) {
                                    // cut out 100 characters
                                    var start = first_occur - 20;
                                    var end = first_occur + 80;
                                    if (start < 0) {
                                        start = 0;
                                    }
                                    if (start == 0) {
                                        end = 100;
                                    }
                                    if (end > content.length) {
                                        end = content.length;
                                    }
                                    var match_content = content.substring(start, end);
                                    // highlight all keywords
                                    keywords.forEach(function(keyword) {
                                        var regS = new RegExp(keyword, "gi");
                                        match_content = match_content.replace(regS, "<span class=\"search-keyword red lighten-2\">" + keyword + "</span>");
                                    });

                                    str += "<p class=\"search-result\">..." + match_content + "...</p>"
                                }
                                str += "</li>";
                            }
                        });
                        str += "</ul>";
                        $resultContent.innerHTML = str;
                    });
                }
            });
        }
    })(jQuery);
</script>


<script src="/js/prettify.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("pre").addClass("prettyprint");
        prettyPrint();
    });
</script>








</body>
</html>
